package syyrjx.controller;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class RegResultServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.display(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.display(request, response);
    }
    private void display(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String flag = request.getParameter("res");
        System.out.println(flag);
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out = response.getWriter();
        if(flag == "0"){
            out.print("<span style=\"font-size:40px\">注册失败</span>");
        }else{
            out.print("<span style=\"font-size:40px\">注册成功</span>");
        }
        out.print("<a href=\"http://localhost:8080/onlineSystem/log\">点击返回登录页</a>");
    }
}
